
clear
set matsize 5000
cd <directory>
**********************************************************************************************************************
** Takes the raw salary csv data and converts it to dta files
**********************************************************************************************************************


clear all 
set more off 
	
	qui {
	
	local year "2010 2011 2012 2013"
	
	foreach j of local  year {
	
		local month "jan feb mar apr may jun jul aug sep oct nov dec"
			

		
		foreach i of local  month {

			nois di "`i' `j'"	
			
			import delimited "sal_`i'_`j'.txt", delimiter("*") clear
			
			isid unit tkn_no	
			
			*Clean the grade variable. The grades are only applicable to tailors 
			replace grade = "" if designation != "TAILOR" 
			replace grade = "" if subdepartment != "SEWING"
			
			replace grade = "" if grade == "SEAS" | grade == "SEBD" | grade == "SKAV" ///
			| grade == "UNAE" |  grade == "UNAH" |  grade == "UNP" | grade == "NA"
 				
			save "sal_`i'_`j'", replace 

		
		}
		
	}
	
	}

	
	
